﻿using System;

namespace SindelsStarship
{
    class Score : IEquatable<Score>, IComparable<Score>//class with string and int
    {
        public string Name { get; set; }
        public int Points { get; set; }

        public Score(string name, int points)
        {
            this.Name = name;
            this.Points = points;
        }

        public override string ToString()//ToString method returns special string
        {
            return Name + " - " + Points;
        }

        public int CompareTo(Score comparePart)//use for sort method comparison
        {
            // A null value means that this object is greater. 
            if (comparePart == null)
                return 1;

            else
                return comparePart.Points.CompareTo(this.Points);
        }

        public bool Equals(Score other)
        {
            if (other == null) return false;
            return (this.Points.Equals(other.Points));
        }
    }
}
